<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The ArrayIterator class</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="appenditerator.valid.html">AppendIterator::valid</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="arrayiterator.append.html">ArrayIterator::append</a></div>
 <div class="up"><a href="spl.iterators.html">迭代器</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.arrayiterator" class="reference">
 <h1 class="title">The ArrayIterator class</h1>
 
 
 <div class="partintro"><p class="verinfo">(PHP 5)</p>
 

  <div class="section" id="arrayiterator.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    这个迭代器允许在遍历数组和对象时删除和更新值与键
   </p>
   <p class="para">
    当你想多次遍历相同数组时你需要实例化ArrayObject，然后让这个实例创建一个ArrayIteratror实例
    当你想遍历相同数组时多次你需要实例ArrayObject并且让这个实例创建一个ArrayIteratror实例，然后使用<a href="control-structures.foreach.html" class="link">foreach</a>或者
    手动调用getIterator()方法 
   </p>
  </div>

 
  <div class="section" id="arrayiterator.synopsis">
   <h2 class="title">类摘要</h2>
 

   <div class="classsynopsis">
    <div class="ooclass"></div>
 

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <strong class="classname">ArrayIterator</strong>
     </span>

     <span class="oointerface">implements 
      <span class="interfacename"><strong class="interfacename">ArrayAccess</strong></span>
     </span>
 
     <span class="oointerface">, 
      <span class="interfacename"><a href="class.seekableiterator.html" class="interfacename">SeekableIterator</a></span>
     </span>
 
     <span class="oointerface">, 
      <span class="interfacename"><a href="class.countable.html" class="interfacename">Countable</a></span>
     </span>

     <span class="oointerface">, 
      <span class="interfacename"><strong class="interfacename">Serializable</strong></span>
     </span>
 
     {</div>

 
    
 
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="arrayiterator.append.html" class="methodname">append</a></span>
    ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="arrayiterator.asort.html" class="methodname">asort</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="arrayiterator.construct.html" class="methodname">__construct</a></span>
    ([ <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$array</code><span class="initializer"> = array()</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = 0</span></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="arrayiterator.count.html" class="methodname">count</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">mixed</span><span class="methodname"><a href="arrayiterator.current.html" class="methodname">current</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span><span class="methodname"><a href="arrayiterator.getarraycopy.html" class="methodname">getArrayCopy</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="arrayiterator.getflags.html" class="methodname">getFlags</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">mixed</span><span class="methodname"><a href="arrayiterator.key.html" class="methodname">key</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="arrayiterator.ksort.html" class="methodname">ksort</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="arrayiterator.natcasesort.html" class="methodname">natcasesort</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="arrayiterator.natsort.html" class="methodname">natsort</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="arrayiterator.next.html" class="methodname">next</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="arrayiterator.offsetexists.html" class="methodname">offsetExists</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$index</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">mixed</span><span class="methodname"><a href="arrayiterator.offsetget.html" class="methodname">offsetGet</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$index</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="arrayiterator.offsetset.html" class="methodname">offsetSet</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$index</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$newval</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="arrayiterator.offsetunset.html" class="methodname">offsetUnset</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$index</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="arrayiterator.rewind.html" class="methodname">rewind</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="arrayiterator.seek.html" class="methodname">seek</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$position</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="arrayiterator.serialize.html" class="methodname">serialize</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="arrayiterator.setflags.html" class="methodname">setFlags</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$flags</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="arrayiterator.uasort.html" class="methodname">uasort</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$cmp_function</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="arrayiterator.uksort.html" class="methodname">uksort</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$cmp_function</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="arrayiterator.unserialize.html" class="methodname">unserialize</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$serialized</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="arrayiterator.valid.html" class="methodname">valid</a></span>
    ( <span class="methodparam">void</span>
   )</div>

   }</div>
 
  </div>
 

 
 </div>
 
 


































































































































































 
<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="arrayiterator.append.html">ArrayIterator::append</a> — Append an element</li><li><a href="arrayiterator.asort.html">ArrayIterator::asort</a> — Sort array by values</li><li><a href="arrayiterator.construct.html">ArrayIterator::__construct</a> — Construct an ArrayIterator</li><li><a href="arrayiterator.count.html">ArrayIterator::count</a> — Count elements</li><li><a href="arrayiterator.current.html">ArrayIterator::current</a> — Return current array entry</li><li><a href="arrayiterator.getarraycopy.html">ArrayIterator::getArrayCopy</a> — Get array copy</li><li><a href="arrayiterator.getflags.html">ArrayIterator::getFlags</a> — Get flags</li><li><a href="arrayiterator.key.html">ArrayIterator::key</a> — Return current array key</li><li><a href="arrayiterator.ksort.html">ArrayIterator::ksort</a> — Sort array by keys</li><li><a href="arrayiterator.natcasesort.html">ArrayIterator::natcasesort</a> — Sort an array naturally, case insensitive</li><li><a href="arrayiterator.natsort.html">ArrayIterator::natsort</a> — Sort an array naturally</li><li><a href="arrayiterator.next.html">ArrayIterator::next</a> — Move to next entry</li><li><a href="arrayiterator.offsetexists.html">ArrayIterator::offsetExists</a> — Check if offset exists</li><li><a href="arrayiterator.offsetget.html">ArrayIterator::offsetGet</a> — Get value for an offset</li><li><a href="arrayiterator.offsetset.html">ArrayIterator::offsetSet</a> — Set value for an offset</li><li><a href="arrayiterator.offsetunset.html">ArrayIterator::offsetUnset</a> — Unset value for an offset</li><li><a href="arrayiterator.rewind.html">ArrayIterator::rewind</a> — Rewind array back to the start</li><li><a href="arrayiterator.seek.html">ArrayIterator::seek</a> — Seek to position</li><li><a href="arrayiterator.serialize.html">ArrayIterator::serialize</a> — Serialize</li><li><a href="arrayiterator.setflags.html">ArrayIterator::setFlags</a> — Set behaviour flags</li><li><a href="arrayiterator.uasort.html">ArrayIterator::uasort</a> — User defined sort</li><li><a href="arrayiterator.uksort.html">ArrayIterator::uksort</a> — User defined sort</li><li><a href="arrayiterator.unserialize.html">ArrayIterator::unserialize</a> — Unserialize</li><li><a href="arrayiterator.valid.html">ArrayIterator::valid</a> — Check whether array contains more entries</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="appenditerator.valid.html">AppendIterator::valid</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="arrayiterator.append.html">ArrayIterator::append</a></div>
 <div class="up"><a href="spl.iterators.html">迭代器</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
